package Dat04;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;

public class Test01 {
    /**
     * 创建一个"raf.dat"的文件，并在其中写出一个int的最大值，long的最大值，
     * 然后将其分别读取出来并输出
     * @author Admin
     *
     */
    public static void main(String[] args) {
        try {
            RandomAccessFile raf = new RandomAccessFile("src/Dat04/raf.dat", "rw");
            try {
                raf.writeInt(Integer.MAX_VALUE);
                raf.writeLong(Integer.MAX_VALUE);
                raf.seek(0);
                System.out.println(raf.readInt());
                System.out.println(raf.readLong());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        } catch (FileNotFoundException e) {
            throw new RuntimeException(e);
        }
    }
}
